package com.lepu.app.fun.index.bean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

public class BeanWriterComment implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public String UserID;
	public String UserNickName;
	public String UserAvatar;
	public String CommentID;
	public String CommentContent;
	public String RecordCreateTime;
	public String IsForbidden;
	public String FavourCount;
	public String HasFavour;
	public QuoteComment QuoteComment;
	
	public static ArrayList<BeanWriterComment> parseJsonHotData(String dataString) {
		String result = "";
		try {
			JSONObject jsonObject = new JSONObject(dataString);
			JSONObject obj1 = (JSONObject) jsonObject.get("Result");
			JSONObject obj2 = (JSONObject) obj1.getJSONObject("DetailInfo");
			JSONArray obj3 = (JSONArray) obj2.getJSONArray("HotCommentList");

			result = obj3.toString();
		} catch (JSONException e) {
			e.printStackTrace();
		}

		Gson gson = new Gson();
		ArrayList<BeanWriterComment> testArraylist = gson.fromJson(result,new TypeToken<List<BeanWriterComment>>() {
				}.getType());
		return testArraylist;
	}
	
	public static ArrayList<BeanWriterComment> parseJsonNewData(String dataString) {
		String result = "";
		try {
			JSONObject jsonObject = new JSONObject(dataString);
			JSONObject obj1 = (JSONObject) jsonObject.get("Result");
			JSONObject obj2 = (JSONObject) obj1.getJSONObject("DetailInfo");
			JSONArray obj3 = (JSONArray) obj2.getJSONArray("NewCommentList");

			result = obj3.toString();
		} catch (JSONException e) {
			e.printStackTrace();
		}

		Gson gson = new Gson();
		ArrayList<BeanWriterComment> testArraylist = gson.fromJson(result,new TypeToken<List<BeanWriterComment>>() {
				}.getType());
		return testArraylist;
	}
	
	public class QuoteComment{
		public String UserID;
		public String UserNickName;
		public String UserAvatar;
		public String CommentID;
		public String CommentContent;
		public String RecordCreateTime;
		public String IsForbidden;
	}
	
}
